/*
 * Administrator manager
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.bookingmanager.dao;

import cz.muni.fi.pa165.bookingmanager.entities.Administrator;
import cz.muni.fi.pa165.bookingmanager.exceptions.IllegalOrphanException;
import cz.muni.fi.pa165.bookingmanager.exceptions.NonexistentEntityException;
import cz.muni.fi.pa165.bookingmanager.exceptions.PreexistingEntityException;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Jiří Holuša
 */
@Local
public interface AdministratorManager {
    
    /**
     * Creates new Administrator in database and sets its ID
     * 
     * @param administrator Administrator object to be created
     * @throws IllegalOrphanException when administrator id is already set
     * @throws PreexistingEntityException 
     * @throws IllegalArgumentException when administrator is null
     */
    public void createAdministrator(Administrator administrator) throws IllegalOrphanException, PreexistingEntityException;
    
    /**
     * Updates existing Administrator in database
     * 
     * @param administrator Administrator object to be updated
     * @throws IllegalArgumentException when administrator == null or some of the not-optional arguments of Administrator is missing
     * @throws IllegalOrphanException when administrator id == null
     * @throws PreexistingEntityException 
     * @throws Exception 
     * @throws NonexistentEntityException when Administrator with set id doesn't exist in database
     */
    public void updateAdministrator(Administrator administrator) throws NonexistentEntityException, IllegalOrphanException, PreexistingEntityException, Exception;
    
    /**
     * Deletes Administrator from database
     * 
     * @param administrator 
     * @throws IllegalArgumentException when administrator == null
     * @throws IllegalOrphanException when administrator id == null
     * @throws NonexistentEntityException when Administrator with set id doesn't exist in database
     */
    public void deleteAdministrator(Administrator administrator) throws NonexistentEntityException, IllegalOrphanException;
    
    /**
     * Retrieves Administrator by ID
     * 
     * @param administratorId id of the administrator to be retrived
     * @return Administrator object with set ID or null when administrator object doesn't exist
     */
    public Administrator getAdministratorById(Long administratorId);
        
    /**
     * Retrieves List of all administrators in database 
     * @return List of Administrator object with set ID or empty List when administrators object doesn't exist 
     */
    public List<Administrator> findAllAdministrators();
    
    public Administrator getAdministratorByUserName(String username);
    
}
